package com.atcd.springboot2.httpTracerepository;


import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.trace.http.HttpTrace;
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;

import java.util.Collections;
import java.util.List;

public class RemoteHttpTraceRepository implements HttpTraceRepository {

    private static final Logger LOGGER = LoggerFactory.getLogger(RemoteHttpTraceRepository.class);

    @Override
    public List<HttpTrace> findAll() {
        return Collections.emptyList();
    }

    @Override
    public void add(HttpTrace trace) {
        // 发送别人请求的响应到服务器日志当中
        LOGGER.info(JSON.toJSONString(trace));
    }
}